<?php

namespace App\Console\Commands;

use App\Models\Adreward;
use App\Models\AdrewardDetail;
use App\Models\Commission;
use App\Models\OAuthUser;
use App\Models\Transaction;
use App\Models\User;
use App\Models\UserWallet;
use App\Models\UserWalletActive;
use App\Models\UserWithdraw;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class FlushCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'flush';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '[Dev Only] Flushes database';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $models = [
            User::class,
            UserWallet::class,
            UserWalletActive::class,
            UserWithdraw::class,

            Adreward::class,
            AdrewardDetail::class,

            OAuthUser::class,
            Transaction::class,
            Commission::class,
        ];

        foreach ($models as $model) {
            $model::truncate();
            $this->info(sprintf("%s TRUNCATED.", $model));
        }
    }
}
